extends Node

# =====================调节变量部分===============================
# 文本刷新速度
const text_speed = 0.1
const audio_speed = 0.11

var auto_music = 0
var auto_fx = 0
var auto_speed = 0.18
# 窗口高度
const window_h = 600



# =====================游戏机制部分==============================

# 选项判别部分(请勿随意修改)
var option_number:int
var dialog_data:Array = []
var is_auto:bool = false
var music_path:String
var scene_path:String
var left_role_path:String = "hide"
var right_role_path:String = "hide"

func _ready():
	pass

# =====================存储功能设置====================================

func save_ezgal(file_name:String, time_load:int,now_text:int,now_role:String):
	var file = File.new()
	var dialog = ""
	for i in dialog_data:
		dialog += i + "[&]"
	file.open("user://{file_name}.txt".format({file_name=file_name}), File.WRITE)
	file.store_string("auto_music = {auto_music}\nauto_fx = {auto_fx}\ntime_load = {time_load}\nnow_text = {now_text}\n{now_role}\n{music_path}\n{scene_path}\n{left_role_path}\n{right_role_path}\n{dialog}".format({
		auto_music = AudioServer.get_bus_volume_db(1),
		auto_fx = AudioServer.get_bus_volume_db(2),
		time_load = time_load,
		now_text = now_text,
		now_role = now_role,
		music_path = music_path,
		scene_path = scene_path,
		left_role_path = left_role_path,
		right_role_path = right_role_path,
		dialog = dialog
	}))
	file.close()

func load_ezgal(file_name:String, number:int):
	var file = File.new()
	file.open("user://{file_name}.txt".format({file_name=file_name}), File.READ)
	var content = file.get_as_text()
	file.close()
	return content.get_slice("\n", number)
